package bnetwork;

public class CopyOfClimateNetwork {

	private static final int SEASON_DOMAIN = 2;
//	private static final int SENSING_DOMAIN = 2;
	private static final int ICE_DOMAIN = 2;
	private static final int CLIMATE_DOMAIN = 3; 
	double summer;
	double summerWarm;
	double summerCold;
	double summerFrigid;
	double winterWarm;
	double winterCold;
	double winterFrigid;
	double warmIce;
	double coldIce;
	double frigidIce;
	
	Node region;
	Node season;
	Node climate;
	Node ice;
	Node sensing1;
	Node sensing2;

	public CopyOfClimateNetwork(int regionId, double[][] regionProbs, double sensingP){
		//regionProbs:
		//				{{summerWarm, summerCold, summerFrigid}, 
		//				 {winterWarm, winterCold, winterFrigid}};
		
		//regions = new Node("region", regionProbs.length, null, new double[][]{{1,0,0}});
		region = new Node("region" + regionId, 1, null, new double[][]{{1}});	//region is an evidence

		season = new Node("season", SEASON_DOMAIN, null, new double[][]{{summer, (1-summer)}});

		
		climate = new Node("climate", CLIMATE_DOMAIN, new Node[]{season, region}, regionProbs);
		
		double[][] iceDeps = new double[][]{
				{warmIce, (1-warmIce)},
				{coldIce, (1-coldIce)},					
				{frigidIce, (1-frigidIce)}};
		ice = new Node("ice", ICE_DOMAIN, new Node[]{climate}, iceDeps);
		
		sensing1 = new Node("sensing1", 2, null, new double[][]{{1,0,0}});
		sensing2 = new Node("sensing2", 2, null, new double[][]{{1,0,0}});
	}
	
//	double[][] climateDeps = new double[SEASON_DOMAIN*regionProbs.length][CLIMATE_DOMAIN];
//	for (int i=0; i<regionProbs.length; i++){	//for each region
//		for (int j=0; j<SEASON_DOMAIN; j++){	//for each season
//			climateDeps[j+SEASON_DOMAIN*regionProbs.length][0] = regionProbs[i][j][0];	//region i, season j, warm
//			climateDeps[j+SEASON_DOMAIN*regionProbs.length][1] = regionProbs[i][j][1];	//region i, season j, cold
//			climateDeps[j+SEASON_DOMAIN*regionProbs.length][2] = regionProbs[i][j][2];	//region i, season j, frigid
//		}
//	}
	//0 - season summer, region 0
	//1 - season winter, region 0
	//2 - season summer, region 1
	//3 - season winter, region 1
	//4 - season summer, region 2
	//5 - season winter, region 2
	
//	double s1PWarmIce = warmIce+sensingP-warmIce*sensingP;
//	double s1PColdIce = coldIce+sensingP-coldIce*sensingP;
//	double s1PFrigidIce = frigidIce+sensingP-frigidIce*sensingP;
//	double s1PWarmNoIce = warmIce+(1-sensingP)-warmIce*(1-sensingP);
//	double s1PColdNoIce = coldIce+(1-sensingP)-coldIce*(1-sensingP);
//	double s1PFrigidNoIce = frigidIce+(1-sensingP)-frigidIce*(1-sensingP);
//	double s1PWarmIceIce = warmIce+sensingP+sensingP-warmIce*sensingP-warmIce*sensingP-sensingP*sensingP+warmIce*sensingP*sensingP;
//	double s1PColdIceIce = coldIce+sensingP-coldIce*sensingP;
//	double s1PFrigidIceIce = frigidIce+sensingP-frigidIce*sensingP;
//	double[][] iceDeps = new double[][]{
//			{warmIce, (1-warmIce)},					//warm, s1=s2=-1
//			{coldIce, (1-coldIce)},					//cold, s1=s2=-1
//			{frigidIce, (1-frigidIce)},				//frigid, s1=s2=-1
//			{s1PWarmNoIce, (1-s1PWarmNoIce)},		//warm, s1=0, s2=-1
//			{s1PColdNoIce, (1-s1PColdNoIce)},		//cold, s1=0, s2=-1
//			{s1PFrigidNoIce, (1-s1PFrigidNoIce)},	//frigid, s1=0, s2=-1
//			{s1PWarmIce, (1-s1PWarmIce)},		//warm, s1=1, s2=-1
//			{s1PColdIce, (1-s1PColdIce)},		//cold, s1=1, s2=-1
//			{s1PFrigidIce, (1-s1PFrigidIce)},	//frigid, s1=1, s2=-1
//			{s1PWarmNoIce, (1-s1PWarmNoIce)},		//warm, s1=-1, s2=0
//			{s1PColdNoIce, (1-s1PColdNoIce)},		//cold, s1=-1, s2=0
//			{s1PFrigidNoIce, (1-s1PFrigidNoIce)},	//frigid, s1=-1, s2=0
//			{,},		//warm,   s1=0,  s2=0
//			{,},		//cold,   s1=0,  s2=0
//			{,},		//frigid, s1=0,  s2=0
//			{,},		//warm,   s1=1,  s2=0
//			{,},		//cold,   s1=1,  s2=0
//			{,}};		//frigid, s1=1,  s2=0
}
